/****************************************************
          File Name:list_quque.c
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Tue 10 Feb 2015 10:05:58 AM CST
*****************************************************/

#include<stdlib.h>
#include"list_quque.h"

int main(int argc, char *argv[])
{
    Queue *q;
    Mydata data;
    int size;

    printf("enter queue length: "); scanf("%d", &size);
    InitQueue(&q, size);

    for(int i=0; i<size; i++)
    {
        printf("enter a number: "); scanf("%d", &data);
        if(!EnQueue(&q, data))
        {
            printf("EnQueue Failed\n");
            exit(1);
        }
    }

    printf("Queue size: %d (before)\n", QueueLength(q));
    printf("dequeue 3 of %d...\n", size);
    for(int i=0; i<3; i++)
    {
        if(!DeQueue(&q, &data))
        {
            printf("DeQueue failed\n");
            exit(1);
        }
        printf("\t\t%d\n", data);
    }
    printf("Queue size: %d (after)\n", QueueLength(q));

    printf("destroy...\n");
    Destroy(q);

    return 0;
}
